
import mhv.fr.sprite.Sprite;
import mhv.fr.sprite.container.SpriteContainer;
import mhv.fr.sprite.controller.SpriteController;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Marc-Henri
 */
public class MushroomController extends SpriteController {

    final int SPRITE_SHIP = 1;
    final int SPRITE_BULLET = 2;
    final int SPRITE_MUSHROOM_NORMAL = 10;
    final int SPRITE_MUSHROOM_HIT_1 = 11;
    final int SPRITE_MUSHROOM_HIT_2 = 12;
    final int SPRITE_CENTIPEDE_HEAD = 20;
    final int SPRITE_CENTIPED_BODY = 21;
    final int SPRITE_SPIDER = 30;

    @Override
    public void doCollide(Sprite sp) {
        switch (sp.getType()) {
            case SPRITE_BULLET:
                Sprite mush = SpriteContainer.getInstance().getSprite(getSpriteId());
                switch (getGameEntity().getType()) {
                    case SPRITE_MUSHROOM_NORMAL:
                        getGameEntity().setType(SPRITE_MUSHROOM_HIT_1);
                        mush.loadImage("Images/mush_hit1.png");
                        break;
                    case SPRITE_MUSHROOM_HIT_1:
                        getGameEntity().setType(SPRITE_MUSHROOM_HIT_2);
                        mush.loadImage("Images/mush_hit2.png");
                        break;
                    case SPRITE_MUSHROOM_HIT_2:
                        getGameEntity().setAlive(false);
                        break;
                }
                break;
        }
    }

    public MushroomController() {
    }
}
